package com.vislardo.app.notebook.model;

import cn.hutool.core.util.StrUtil;
import lombok.Data;

@Data
public class NotePage {

    private int pageNumber;

    private String content;

    private boolean lastPage;

    public boolean isEmpty() {
        return StrUtil.isEmpty(content);
    }

    private NotePage(){
        this.pageNumber=1;
        this.lastPage = true;
        this.content = "";
    }

    public NotePage(int pageNumber,String content){
        this.pageNumber = pageNumber;
        this.content = content;
        this.lastPage = false;
    }

    public static NotePage getNewPage(NotePage page){
        NotePage newpage = new NotePage();
        if(page != null){page.setLastPage(false); newpage.setPageNumber(page.getPageNumber()+1);}
        return newpage;
    }

    public NotePage setlast(){
       this.lastPage = true;
       return this;
    }

}
